<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: Aggregation Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00005.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pri-types">Private Types</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">Aggregation Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="Aggregation" --><!-- doxytag: inherits="BaseLayer" -->
<p>this class aggregates the packets received from the application layer and separates packet emissions by a time InterPacketDelay.  
 <a href="a00005.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00489_source.html">Aggregation.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Aggregation:</div>
<div class="dyncontent">
<div class="center"><img src="a00541.png" border="0" usemap="#Aggregation_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for Aggregation:</div>
<div class="dyncontent">
<div class="center"><img src="a00542.png" border="0" usemap="#Aggregation_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00543.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#acf3b1cfc2915c422e5a10e7993884b9b">initialize</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization of the module and some variables.  <a href="#acf3b1cfc2915c422e5a10e7993884b9b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a23a9449e9da9c20870401f6447ab6be2"></a><!-- doxytag: member="Aggregation::finish" ref="a23a9449e9da9c20870401f6447ab6be2" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a23a9449e9da9c20870401f6447ab6be2">finish</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the simulation has finished. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8842b174cfe5d24701929f92c4141317"></a><!-- doxytag: member="Aggregation::handleSelfMsg" ref="a8842b174cfe5d24701929f92c4141317" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a8842b174cfe5d24701929f92c4141317">handleSelfMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle self messages such as timer... <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a9723e5a17551e41ae8a7de5078f6ac7f">handleUpperMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from upper layer.  <a href="#a9723e5a17551e41ae8a7de5078f6ac7f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab3b44d15baaa9f4df289db09b80d4e52"></a><!-- doxytag: member="Aggregation::handleLowerMsg" ref="ab3b44d15baaa9f4df289db09b80d4e52" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#ab3b44d15baaa9f4df289db09b80d4e52">handleLowerMsg</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a353bd188f3fe9b10669693535c418c0e"></a><!-- doxytag: member="Aggregation::handleLowerControl" ref="a353bd188f3fe9b10669693535c418c0e" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a353bd188f3fe9b10669693535c418c0e">handleLowerControl</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac14f64c8962a1ffc3e5bb08f31ece68a"></a><!-- doxytag: member="Aggregation::handleUpperControl" ref="ac14f64c8962a1ffc3e5bb08f31ece68a" args="(cMessage *msg)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#ac14f64c8962a1ffc3e5bb08f31ece68a">handleUpperControl</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from upper layer. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-types"></a>
Private Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9dfe7efa90d418375b00a0a2e17b5102"></a><!-- doxytag: member="Aggregation::destInfo" ref="a9dfe7efa90d418375b00a0a2e17b5102" args="" -->
typedef std::pair&lt; simtime_t, <br class="typebreak"/>
std::list&lt; ApplPkt * &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>destInfo</b></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3934c88320964519d54854c553581f1b"></a><!-- doxytag: member="Aggregation::Aggregation" ref="a3934c88320964519d54854c553581f1b" args="(const Aggregation &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a3934c88320964519d54854c553581f1b">Aggregation</a> (const <a class="el" href="a00005.html">Aggregation</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a907fe3f56ccfe0ea5b5602828299f1c4"></a><!-- doxytag: member="Aggregation::operator=" ref="a907fe3f56ccfe0ea5b5602828299f1c4" args="(const Aggregation &amp;)" -->
<a class="el" href="a00005.html">Aggregation</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00005.html#a907fe3f56ccfe0ea5b5602828299f1c4">operator=</a> (const <a class="el" href="a00005.html">Aggregation</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a02d91d701bc60eb40188c5f9fae78aaf"></a><!-- doxytag: member="Aggregation::isOkToSendNow" ref="a02d91d701bc60eb40188c5f9fae78aaf" args="(const LAddress::L3Type &amp;dest)" -->
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>isOkToSendNow</b> (const <a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a> &amp;dest)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a91d8c260d470399ac97a388f9ab2c47c"></a><!-- doxytag: member="Aggregation::sendAggregatedPacketNow" ref="a91d8c260d470399ac97a388f9ab2c47c" args="(const LAddress::L3Type &amp;dest)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>sendAggregatedPacketNow</b> (const <a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a> &amp;dest)</td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab98b40b8c660cbdecfd8f2f95c220540"></a><!-- doxytag: member="Aggregation::destInfos" ref="ab98b40b8c660cbdecfd8f2f95c220540" args="" -->
std::map&lt; <a class="el" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4">LAddress::L3Type</a>, <br class="typebreak"/>
destInfo &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>destInfos</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae648f73f274251b488a7e46d3845f932"></a><!-- doxytag: member="Aggregation::aggregationTimer" ref="ae648f73f274251b488a7e46d3845f932" args="" -->
cMessage *&#160;</td><td class="memItemRight" valign="bottom"><b>aggregationTimer</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0abe9f87f1f0ca50edae0ff34c7e4963"></a><!-- doxytag: member="Aggregation::interPacketDelay" ref="a0abe9f87f1f0ca50edae0ff34c7e4963" args="" -->
simtime_t&#160;</td><td class="memItemRight" valign="bottom"><b>interPacketDelay</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aef3536282aa4bb5ab096cadce567c5c8"></a><!-- doxytag: member="Aggregation::nbMaxPacketsPerAggregation" ref="aef3536282aa4bb5ab096cadce567c5c8" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>nbMaxPacketsPerAggregation</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af832b5c9509f380afe2307ccb51deb22"></a><!-- doxytag: member="Aggregation::nbAggrPktSentDown" ref="af832b5c9509f380afe2307ccb51deb22" args="" -->
long&#160;</td><td class="memItemRight" valign="bottom"><b>nbAggrPktSentDown</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6b133c36db4e8186c94d9396730a1c01"></a><!-- doxytag: member="Aggregation::nbAggrPktReceived" ref="a6b133c36db4e8186c94d9396730a1c01" args="" -->
long&#160;</td><td class="memItemRight" valign="bottom"><b>nbAggrPktReceived</b></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>this class aggregates the packets received from the application layer and separates packet emissions by a time InterPacketDelay. </p>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a9723e5a17551e41ae8a7de5078f6ac7f"></a><!-- doxytag: member="Aggregation::handleUpperMsg" ref="a9723e5a17551e41ae8a7de5078f6ac7f" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Aggregation::handleUpperMsg </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle messages from upper layer. </p>
<p>This function is pure virtual here, because there is no reasonable guess what to do with it by default. </p>

<p>Implements <a class="el" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b">BaseLayer</a>.</p>

<p>References <a class="el" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8">BaseLayer::sendDown()</a>.</p>
<div class="fragment"><pre class="fragment">                                              {
  ApplPkt* pkt = check_and_cast&lt;ApplPkt*&gt; (msg);
  <span class="keywordflow">if</span> (interPacketDelay == 0) {
    <a class="code" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8" title="Sends a message to the lower layer.">sendDown</a>(msg);
  } <span class="keywordflow">else</span> {
    <span class="keyword">const</span> <a class="code" href="a00117.html#ad85cd9e8d9e7e9cd5d02dd740c4a12a4" title="Type definition for a L3 (Network) address.">LAddress::L3Type</a>&amp; dest = pkt-&gt;getDestAddr();
    <span class="keywordflow">if</span> (!isOkToSendNow(dest)) {
      <span class="comment">// store packet</span>
      destInfos[dest].second.push_back(pkt);
      <span class="comment">// reschedule aggregation timer to &quot;earliest destination&quot;</span>
      simtime_t destTxTime = destInfos[dest].first + interPacketDelay;
      <span class="keywordflow">if</span> (aggregationTimer-&gt;isScheduled()) {
        <span class="keywordflow">if</span> (aggregationTimer-&gt;getArrivalTime() &gt; destTxTime) {
          cancelEvent( aggregationTimer);
          scheduleAt(destTxTime, aggregationTimer);
        }
      } <span class="keywordflow">else</span> {
        scheduleAt(destTxTime, aggregationTimer);
      }
    } <span class="keywordflow">else</span> {
      <span class="comment">// send now</span>
      destInfos[dest].second.push_back(pkt);
      sendAggregatedPacketNow(dest);
    }
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="acf3b1cfc2915c422e5a10e7993884b9b"></a><!-- doxytag: member="Aggregation::initialize" ref="acf3b1cfc2915c422e5a10e7993884b9b" args="(int)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Aggregation::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialization of the module and some variables. </p>
<p>First we have to initialize the module from which we derived ours, in this case <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a>. This module takes care of the gate initialization. </p>

<p>Reimplemented from <a class="el" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb">BaseLayer</a>.</p>
<div class="fragment"><pre class="fragment">                                      {
    <a class="code" href="a00005.html#acf3b1cfc2915c422e5a10e7993884b9b" title="Initialization of the module and some variables.">BaseLayer::initialize</a>(stage);
  <span class="keywordflow">if</span>(stage == 0) {
    interPacketDelay = par(<span class="stringliteral">&quot;interPacketDelay&quot;</span>).doubleValue();
    <span class="keywordflow">if</span>(interPacketDelay &gt; 0) {
      nbMaxPacketsPerAggregation = par(<span class="stringliteral">&quot;nbMaxPacketsPerAggregation&quot;</span>);
      assert(nbMaxPacketsPerAggregation &gt; 0);
      aggregationTimer = <span class="keyword">new</span> cMessage(<span class="stringliteral">&quot;AggregationTimer&quot;</span>);
      nbAggrPktSentDown = 0;
      nbAggrPktReceived = 0;
    } <span class="keywordflow">else</span> {
      interPacketDelay = 0;
    }
  }
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/transport/<a class="el" href="a00489_source.html">Aggregation.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/transport/Aggregation.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00005.html">Aggregation</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
